package java_objects.static_modifier;

public class Method {
	
	int instanceVariable;
	static int staticVariable;
	
	void instanceMethod() {
		// instance method can access static data
		staticVariable = 10;
		
		// instance method can access instance data
		instanceVariable = 10;
		
		// instance method can call both static and non static methods
		staticMethod();
		instanceMethod();
	}
	static void staticMethod() {
		// static method can access static variable
		staticVariable = 10;
		
		// static method can not access instance data
		//instanceVariable = 10; // error
		
		// Cannot make a static reference to the non-static field
		
		// static method can only call other static method
		staticMethod(); // no error
		//instanceMethod(); // error
		
		// Cannot make a static reference to the non-static method
	}
	
	
}
